<?php /*a:1:{s:60:"D:\web\wwwroot\tp5.1\public/../app/admin/view\user\edit.html";i:1517734531;}*/ ?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>表单</title>
    <link rel="stylesheet" href="/static/frame/layui/css/layui.css">
    <link rel="stylesheet" href="/static/frame/static/css/style.css">
    <link rel="icon" href="/static/frame/static/image/code.png">
</head>
<body class="body">


<form class="layui-form" action="" method="post" id="addform">

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
                <input type="type" name="user_name" lay-verify="required" autocomplete="off" class="layui-input" value="<?php echo htmlentities($info['user_name']); ?>" disabled="">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="password" name="password" lay-verify="pass" placeholder="请输入密码" autocomplete="off" class="layui-input" value="">
        </div>
        <div class="layui-form-mid layui-word-aux">请填写6到12位密码</div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户称呼</label>
            <div class="layui-input-inline">
                <input type="type" name="nickname" lay-verify="" autocomplete="off" class="layui-input" value="<?php echo htmlentities($info['nickname']); ?>">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-inline">
                <input type="text" name="email" lay-verify="email" autocomplete="off" class="layui-input" value="<?php echo htmlentities($info['email']); ?>" >
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="1" title="男" <?php echo $info['sex']==1 ? 'checked=""'  : ''; ?>>
            <input type="radio" name="sex" value="0" title="女" <?php echo $info['sex']==0 ? 'checked=""'  : ''; ?>>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="正常" <?php echo $info['status']==1 ? 'checked=""'  : ''; ?>>
            <input type="radio" name="status" value="0" title="禁用" <?php echo $info['status']==0 ? 'checked=""'  : ''; ?>>
        </div>
    </div>

      <div class="layui-form-item">
        <label class="layui-form-label">权限角色</label>
        <div class="layui-input-block">
        <?php foreach($tname as $key=>$vo): ?>
        <input type="checkbox" name="role[]" lay-skin="primary" value="<?php echo htmlentities($vo['id']); ?>" title="<?php echo htmlentities($vo['title']); ?>" <?php if(!(empty($vo['checked']) || (($vo['checked'] instanceof \think\Collection || $vo['checked'] instanceof \think\Paginator ) && $vo['checked']->isEmpty()))): ?>checked<?php endif; ?> <?php echo !empty($vo['status']) ? ""  :  "disabled"; ?>>
        <?php endforeach; ?>
        </div>
      </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">普通文本域</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" class="layui-textarea" name="remark"><?php echo htmlentities($info['remark']); ?></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
<?php if(!(empty($info) || (($info instanceof \think\Collection || $info instanceof \think\Paginator ) && $info->isEmpty()))): ?>
  <input type="hidden" name="id" value="<?php echo htmlentities($info['id']); ?>">
<?php endif; ?>    
<?php echo token(); ?>
</form>
<!-- 通用-970*90 -->


<script src="/static/frame/layui/layui.js" charset="utf-8"></script>
<script src="/static/admin/js/comm.js" charset="utf-8"></script>
<script>
    layui.use(['layer','form','admin'], function(){
        var layer = layui.layer
            ,$ = layui.jquery
            ,form = layui.form
            ,admin = layui.admin;

        //自定义验证规则
        form.verify({
            title: function(value){
                if(value.length < 5){
                    return '标题至少得5个字符啊';
                }
            }
            ,content: function(value){
                layedit.sync(editIndex);
            }
        });

       
        form.on('submit(demo1)', function(data){
            admin.action('<?php echo url('admin/User/edit'); ?>',$("#addform").serialize());
            return false;
        });


    });
</script>
</body>
</html>